<#assign s=JspTaglibs["/WEB-INF/struts-tags.tld"]>
<#assign sj=JspTaglibs["/WEB-INF/struts-jquery-tags.tld"]>

<#assign title="メッセージ"/>
<#if parameters.title?if_exists != "">
      <#assign title=parameters.title/>
</#if>

<#assign confirm="false"/>
<#if parameters.confirm?if_exists != ""&& parameters.confirm?html="true">
      <#assign confirm="true"/>
</#if>

<#assign okFunction=""/>
<#if parameters.okFunction?if_exists != "">
      <#assign okFunction=parameters.okFunction+";"/>
</#if>

<#assign cancelFunction=""/>
<#if parameters.cancelFunction?if_exists != "">
      <#assign cancelFunction=parameters.cancelFunction+";"/>
</#if>

<#assign openFunction=""/>
<#if parameters.openFunction?if_exists != "">
      <#assign openFunction=parameters.openFunction+";"/>
</#if>

<#assign focusOn="はい"/>
<#if parameters.focusOn?if_exists != ""&& parameters.focusOn?html="1">
      <#assign focusOn="いいえ"/>
</#if>

<#assign disabled=""/>
<#if parameters.disabled?if_exists != "" && parameters.disabled?html="true">
      <#assign disabled="disabled='disabled'"/>
</#if>

<#assign readonly=""/>
<#if parameters.readonly?if_exists != "" && parameters.readonly?html="true">
      <#assign readonly="readonly='readonly'"/>
</#if>

<#assign openButtonname=""/>
<#if parameters.openButtonname?if_exists != "">
      <#assign openButtonname=parameters.openButtonname/>
</#if>

<#assign autoOpen="false"/>
<#if parameters.autoOpen?if_exists != "" && parameters.autoOpen?html="true">
      <#assign autoOpen="true"/>
</#if>

<#assign cssClass=""/>
<#if parameters.cssClass?if_exists != "">
      <#assign cssClass="class='"+parameters.cssClass+"'"/>
</#if>

<#assign cssStyle=""/>
<#if parameters.cssStyle?if_exists != "">
      <#assign cssStyle="style='"+parameters.cssStyle+"'"/>
</#if>


<#assign ifCancel=""/>
<#if confirm="true">
      <#assign ifCancel=",'いいえ':function() { $('#${parameters.id?html}_sn_dialog').dialog('close');${cancelFunction} }"/>
</#if>
<div style="display:none;">
<@sj.dialog
    	id="${parameters.id?html}_sn_dialog"
    	buttons="{
    		'はい':function() { $('#${parameters.id?html}_sn_dialog').dialog('close'); ${okFunction} }
    		${ifCancel}
    		}"
    	autoOpen="${autoOpen}"
    	modal="true"
    	title="${title}"
    	onBeforeTopics="${parameters.id?html}_sn_dialog_setfocus"
    >
    ${parameters.msg}
     </@sj.dialog>
    <@sj.a
    	id="${parameters.id?html}_sn_openId"
    	openDialog="${parameters.id?html}_sn_dialog"
    	cssStyle="display:none;"
    >button</@sj.a>
</div>

<button value="${openButtonname}" id="${parameters.id?html}" ${disabled} ${cssClass} ${cssStyle}  onclick="${parameters.id?html}_sn_dialog_open()">${openButtonname}</button>

<script language='javascript'>
	$.subscribe('${parameters.id?html}_sn_dialog_setfocus', function(event,data) {

	});
	function ${parameters.id?html}_sn_dialog_open(){
			$('#${parameters.id?html}_sn_openId').click();
				  $('#${parameters.id?html}_sn_dialog').parent().find('.ui-dialog-buttonpane button').each(function(){
			if($(this).text()=='${focusOn}'){
				$(this).focus();
			}
		});
		${openFunction}
	}

</script>